<?php
class m_guru extends MY_Model {
    public $table = "m_guru";
    public $id = "nip";
	
	public function get_jumlah_menurut_ijazah_tertinggi($jenis_id){
		$q = $this->db->query("Select count(mg.nip) as jumlah, msk.kecamatan_id, mg.jenis_kelamin_id,jenjang_pendidikan_id
								from m_guru mg
								left join m_sekolah msk on msk.id=mg.sekolah_id
								where msk.sekolah_jenis_id =$jenis_id
								group by msk.kecamatan_id, mg.jenjang_pendidikan_id, mg.jenis_kelamin_id ");
        $data = $q->result_array();
		$ret = array();
		foreach($data as $detail){
			$ret[$detail['kecamatan_id']][$detail['jenjang_pendidikan_id']][$detail['jenis_kelamin_id']] = $detail['jumlah'];
		}
		return $ret;
	}
	public function get_jumlah_menurut_sertifikasi($jenis_id){
		$q = $this->db->query("Select count(mg.nip) as jumlah, msk.kecamatan_id, mg.jenis_kelamin_id,mg.sudah_tersertifikasi
								from m_guru mg
								left join m_sekolah msk on msk.id=mg.sekolah_id
								where msk.sekolah_jenis_id =$jenis_id
								group by msk.kecamatan_id, mg.sudah_tersertifikasi, mg.jenis_kelamin_id ");
        $data = $q->result_array();
		$ret = array();
		foreach($data as $detail){
			$ret[$detail['kecamatan_id']][$detail['sudah_tersertifikasi']][$detail['jenis_kelamin_id']] = $detail['jumlah'];
		}
		return $ret;
	}
}